package org.jivesoftware.smackx.provider;

import org.jivesoftware.smack.packet.IQ;
import org.jivesoftware.smack.provider.IQProvider;
import org.jivesoftware.smackx.packet.MUCAdmin;
import org.jivesoftware.smackx.packet.MUCAdmin.Item;
import org.xmlpull.v1.XmlPullParser;

public class MUCAdminProvider
  implements IQProvider
{
  private MUCAdmin.Item parseItem(XmlPullParser paramXmlPullParser)
    throws Exception
  {
    int i = 0;
    MUCAdmin.Item localItem = new MUCAdmin.Item(paramXmlPullParser.getAttributeValue("", "affiliation"), paramXmlPullParser.getAttributeValue("", "role"));
    localItem.setNick(paramXmlPullParser.getAttributeValue("", "nick"));
    localItem.setJid(paramXmlPullParser.getAttributeValue("", "jid"));
    while (true)
    {
      int j;
      label133: 
      do
        while (true)
        {
          do
          {
            if (i != 0)
              return localItem;
            j = paramXmlPullParser.next();
            if (j != 2)
              break label133;
            if (paramXmlPullParser.getName().equals("actor"))
              localItem.setActor(paramXmlPullParser.getAttributeValue("", "jid"));
          }
          while (!(paramXmlPullParser.getName().equals("reason")));
          localItem.setReason(paramXmlPullParser.nextText());
        }
      while ((j != 3) || (!(paramXmlPullParser.getName().equals("item"))));
      i = 1;
    }
  }

  public IQ parseIQ(XmlPullParser paramXmlPullParser)
    throws Exception
  {
    MUCAdmin localMUCAdmin = new MUCAdmin();
    int i = 0;
    while (true)
    {
      int j;
      label56: 
      do
        while (true)
        {
          do
          {
            if (i != 0)
              return localMUCAdmin;
            j = paramXmlPullParser.next();
            if (j != 2)
              break label56;
          }
          while (!(paramXmlPullParser.getName().equals("item")));
          localMUCAdmin.addItem(parseItem(paramXmlPullParser));
        }
      while ((j != 3) || (!(paramXmlPullParser.getName().equals("query"))));
      i = 1;
    }
  }
}